package polimi.disttest.manager;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.jcraft.jsch.SftpProgressMonitor;
 
public class SftpTransferMonitor implements SftpProgressMonitor {
    private static Logger log = Logger.getLogger(SftpProgressMonitor.class);
    private long count=0;
    private long dimension=0;
    private String src="";
    private String dest="";
 
    public SftpTransferMonitor(){
    	
    }
    
    public String getSrc() {
        return src;
    }
 
    public void setSrc(String src) {
        this.src = src;
    }
 
    public String getDest() {
        return dest;
    }
 
    public void setDest(String dest) {
        this.dest = dest;
    }
 
    public long getDimension() {
        return dimension;
    }
 
    public void setDimension(long dimension) {
        this.dimension = dimension;
    }
 
    public long getCount() {
        return count;
    }
 
    public void setCount(long count) {
        this.count = count;
    }
 
    @Override
    public boolean count(long count) {
        this.count+=count;
        log.info("... trasferimento in corso " + src + " ---> "+ dest + " trasferiti " + this.count + " bytes");
        return true;
    }
 
    @Override
    public void end() {
        log.info("fine trasferimento " + src + " ---> "+ dest + " Trasferiti " + count + " bytes");
    }
 
    @Override
    public void init(int op, String   src, String   dest, long max) {
        this.count=0;
        this.dimension=max;
        this.src=src;
        this.dest=dest;
        log.info("inizio trasferimento " + src + " ---> "+ dest + " Dimensione file: " + max + " bytes");
    }
 
}